(function() {

  function doLogin() {
    console.log(1);
    var account = $('[name=account]').val()
    var password = $('[name=password]').val()

    if(!account || !password) {
      return
    }
    var data = {
      account: account,
      password: password
    }
    login(data)
  }

  $('body').on('keydown', function (e) {
    if(e.keyCode == 13) {
      doLogin()
    }
  })

  $('#J_login').on('click', function () {
    doLogin()
  })
}());
